package com.lzz.bottomencapsulation.network;

import android.content.Context;

import com.lzz.bottomencapsulation.consts.NetConsts;
import com.lzz.bottomencapsulation.net.RetrofitBase;

/**
 * 网络请求管理类
 */

public class RequestManager {
    private static RequestManager requestManager;
    private static Apiserver apiService;

    private RequestManager(Context context) {
        if (null == requestManager || null == apiService) {
            apiService = RetrofitBase.getInstace(context).setBaseUrl(NetConsts.BASE_COM_URL)
                    .create(Apiserver.class);
        }
    }

    public static Apiserver getInstance(Context context) {
        if (requestManager == null) {
            synchronized (RequestManager.class) {
                requestManager = new RequestManager(context);
            }
        }
        return apiService;
    }
}